package com.qianyi.rabbitmq.producer;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class MessageProducer {


    @Autowired
    private AmqpTemplate rabbitTemplate;

    /**
     * @param queueName
     * @param message
     * @description 可以自定义发送消息的方法
     */
    public void sendMessage(String queueName, String message) {
        System.out.println(" send message:" + message);
        this.rabbitTemplate.convertAndSend(queueName, message);

    }
}
